#include "stm32f10x.h"                  // Device header
#include "Delay.h"
#include "Motor.h"
#include "Usart.h"
#include "LED.h"
#include "String.h"
#include "ESP8266.h"
#include "Key.h"


uint8_t KeyNum,RxData;
int main(void)
{
	NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
	Usart1_Init();
	LED_Init();
	ESP8266_Init();
	Key_Init();
	while(1)
	{		
		KeyNum = Key_GetNum();
		if (KeyNum==1)
		{
			ConnectTCP_Server();
		}
		
		if (Usart1_GetRxFlag())
		{
			RxData = Usart1_GetRxData();
			if (RxData == 0x32)
			{
				LED8_ON();
			}
			else if (RxData == 0x38)
			{
				LED8_OFF();
			}
			else
			{
			
			}
		}
	}
}


